package be.donovan.gui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;

import be.donovan.gui.helper.ServiceLocator;
import be.donovan.gui.helper.components.AbstractController;
import be.donovan.model.PersonInfo;
import be.donovan.model.persist.PersistenceHelper;

public class NewPersonController extends AbstractController<PersonScreen>{

	@Override
	public void initData() {
	}

	

	@Override
	public void initListeners() {
		getView().setName(getMessage("NewPerson"));
		getView().add(createButton("Save"),BorderLayout.SOUTH);
	}
	
	
	public void onSaveAction(ActionEvent ae){
		PersonInfo personInfo = new PersonInfo();
		getView().mapToObject(personInfo);
		System.out.println(personInfo);
		ServiceLocator.getService(PersistenceHelper.class).save(personInfo);
		stop();
	}



	
}
